contentTransition

The contentTransition modifier specifies a transition animation to apply when the content within a single view changes. Unlike view-level transitions (such as .transition(.move)), contentTransition animates changes in content rather than the insertion or removal of the view itself.

This is particularly useful when updating the contents of views like Text, Image, or symbol-based Image(systemName: ...), providing smooth visual feedback on state or data changes.


Type

contentTransition?: ContentTransition

Supported ContentTransition Values

ValueDescription

"identity"

  • No animation is applied to the content change.
  • The view updates instantly with no visual transition.
<Text contentTransition="identity">{value}</Text>

"interpolate"

  • The view attempts to interpolate between the old and new content where appropriate.
  • Best used with animatable types such as Color, Shape, or View interpolations.
<Rectangle fill={color} contentTransition="interpolate" />

"opacity"

  • Applies a fade effect: old content fades out while new content fades in.
  • Works well with general-purpose views.
<Text contentTransition="opacity">{message}</Text>

"numericText"

  • Specialized transition for Text views displaying numbers.
  • Animates character changes in a way that emphasizes numerical progression.
<Text contentTransition="numericText">{score}</Text>

"numericTextCountsUp"

  • Similar to "numericText", but optimized for numeric increments.
  • Intended for counter-like transitions.
<Text contentTransition="numericTextCountsUp">{level}</Text>

"numericTextCountsDown"

  • Optimized for numeric decrements.
  • Useful for countdowns or decreasing counters.
<Text contentTransition="numericTextCountsDown">{remainingTime}</Text>

"symbolEffect"

  • Applies a default symbol animation when a symbol image changes.
  • Only affects symbol-based images (Image(systemName: ...)) and has no effect on other views.
<Image
  systemName={isOn ? "lightbulb.fill" : "lightbulb"}
  contentTransition="symbolEffect"
/>

"symbolEffectAutomatic"

  • Uses platform-adaptive symbol animation depending on context.
  • Typically provides fade, scale, or morphing effects between symbols.
<Image
  systemName={icon}
  contentTransition="symbolEffectAutomatic"
/>

"symbolEffectReplace"

  • Replaces the layers of one symbol image with another.
  • Provides a more visually fluid symbol swap than abrupt replacement.
<Image
  systemName={currentSymbol}
  contentTransition="symbolEffectReplace"
/>

"symbolEffectAppear" / "symbolEffectDisappear"

  • Explicit transitions for symbol insertion and removal, respectively.
  • These may be combined with visibility-based state changes.
{isShown
  ? <Image
    systemName="checkmark"
    contentTransition="symbolEffectAppear"
  />
  : null}

"symbolEffectScale"

  • Scales the symbol up or down during the content change.
  • Works well for symbol emphasis or status feedback.
<Image
  systemName={statusIcon}
  contentTransition="symbolEffectScale"
/>

Summary

TransitionBest Used For
identityNo animation at all
interpolateAnimatable content (e.g. color, shape)
opacityGeneral-purpose fade-in/fade-out transitions
numericTextText views displaying numbers
numericTextCountsUpAnimated numeric increases
numericTextCountsDownAnimated numeric decreases
symbolEffectTransition between two SF Symbols
symbolEffectAutomaticPlatform-determined symbol transitions
symbolEffectReplaceReplacing symbol layers smoothly
symbolEffectAppearAnimate symbol appearing
symbolEffectDisappearAnimate symbol disappearing
symbolEffectScaleScaling effect on symbol changes

This modifier is ideal for providing subtle, performant feedback in data-driven UI updates while maintaining view identity and layout stability. It is particularly effective in dashboards, counters, toggles, icon transitions, and numerically dynamic interfaces.